home *** CD-ROM | disk | FTP | other *** search
/ Virtual Sex With Asia / Virtual Sex With Asia.iso / mac / Virtual Sex with Asia.Dxr / 00001.ls next >
Encoding:
Text File  |  1997-09-07  |  6.1 KB  |  232 lines

  1. global gMachineType, fixPal, gWhichInterface, gMovieSprite, gPathName, gFileName, gFolderList, gFileList, gDirList, gDxrList, gCstList, gIniList, gDllList, gTxtList, gPicList, gSndList, gMovList, gSeparator
  2.  
  3. on startMovie
  4.   set the trace to 0
  5.   if not (the quickTimePresent) then
  6.     go("noQuickTime")
  7.     go(the frame + 1)
  8.     repeat while the mouseDown
  9.       nothing()
  10.     end repeat
  11.     startTimer()
  12.     repeat while (the timer < 640) and the mouseUp
  13.       nothing()
  14.     end repeat
  15.     halt()
  16.   end if
  17.   unLoad()
  18.   unloadMember()
  19.   set gMachineType to the machineType
  20.   if gMachineType <> 256 then
  21.     if factory("FixPalette") = 0 then
  22.       openXLib("WRONGPAL.XOB")
  23.     end if
  24.     if factory("FixPalette") <> 0 then
  25.       set fixPal to fixPalette(mnew, the stageLeft, the stageTop, the stageRight, the stageBottom)
  26.       fixPal(mPatchIt)
  27.     end if
  28.   end if
  29.   setProp(1, 48, "puppet", 0)
  30.   setProp(1, 48, "visibility", 1)
  31.   set gMovieSprite to 15
  32.   set the fileName of cast "INTRO.MOV" to the pathName & "DigiLogo.MOV"
  33. end
  34.  
  35. on launchMovie
  36.   if the machineType = 256 then
  37.     set gSeparator to "\"
  38.   else
  39.     set gSeparator to ":"
  40.   end if
  41.   openFile(the pathName, "asia")
  42.   if the result = 1 then
  43.     exit
  44.   end if
  45.   if the machineType <> 256 then
  46.     openFile("VSexAsia", "asia")
  47.     if the result = 1 then
  48.       exit
  49.     end if
  50.   end if
  51.   set x to "I could not find any data files" & RETURN & "pertaining to this application." & RETURN & RETURN
  52.   set x to x & "Please refer to any accompanying" & RETURN & QUOTE & "Read Me" & QUOTE & " files for further directions."
  53.   alert(x)
  54.   halt()
  55. end
  56.  
  57. on openFile whichPath, whichFile
  58.   if the last char in whichPath <> gSeparator then
  59.     set whichPath to whichPath & gSeparator
  60.   end if
  61.   set gPathName to whichPath
  62.   siftFileNames(gPathName)
  63.   if not voidp(whichFile) then
  64.     set gFileName to lowercase(whichFile)
  65.   end if
  66.   put RETURN
  67.   attemptOpen(gDxrList, gFileName & ".dxr")
  68.   if the result = 1 then
  69.     return 1
  70.     exit
  71.   end if
  72.   attemptOpen(gDirList, gFileName & ".dir")
  73.   if the result = 1 then
  74.     return 1
  75.     exit
  76.   end if
  77.   attemptOpenBuild(gDirList, gFileName & ".dir")
  78.   return the result
  79. end
  80.  
  81. on siftFileNames whichPath
  82.   set gFolderList to []
  83.   set gFileList to []
  84.   set gDirList to []
  85.   set gDxrList to []
  86.   set gCstList to []
  87.   set gIniList to []
  88.   set gDllList to []
  89.   set gTxtList to []
  90.   set gPicList to []
  91.   set gSndList to []
  92.   set gMovList to []
  93.   set the itemDelimiter to "."
  94.   set gFileName to lowercase(item 1 of the movie)
  95.   repeat with x = 1 to the maxinteger
  96.     set fileX to getNthFileNameInFolder(whichPath, x)
  97.     set fileX to lowercase(fileX)
  98.     case fileX of
  99.       EMPTY:
  100.         exit repeat
  101.       otherwise:
  102.         set fileExtension to char 1 to 3 of item 2 of fileX
  103.         case fileExtension of
  104.           EMPTY:
  105.             append(gFolderList, fileX)
  106.           otherwise:
  107.             append(gFileList, fileX)
  108.             case fileExtension of
  109.               "dir":
  110.                 append(gDirList, fileX)
  111.               "dxr":
  112.                 append(gDxrList, fileX)
  113.               "cst":
  114.                 append(gCstList, fileX)
  115.               "ini":
  116.                 append(gIniList, fileX)
  117.               "dll":
  118.                 append(gDllList, fileX)
  119.               "txt", "dat", "dta":
  120.                 append(gTxtList, fileX)
  121.               "pct", "pic", "gif":
  122.                 append(gPicList, fileX)
  123.               "aif", "snd", "wav":
  124.                 append(gSndList, fileX)
  125.               "avi", "mov":
  126.                 append(gMovList, fileX)
  127.             end case
  128.         end case
  129.     end case
  130.   end repeat
  131.   set the itemDelimiter to ","
  132. end
  133.  
  134. on attemptOpen whichList, whichName
  135.   case getPos(whichList, whichName) of
  136.     0:
  137.       put "Attempt to open '" & gPathName & whichName & "' failed."
  138.       return 0
  139.       exit
  140.     otherwise:
  141.       put "Attempt to open '" & gPathName & whichName & "' successful."
  142.       go(1, gPathName & whichName)
  143.       return 1
  144.       abort()
  145.       exit
  146.   end case
  147. end
  148.  
  149. on attemptOpenBuild whichList, whichName
  150.   set maxCount to count(whichList)
  151.   repeat with x = maxCount down to 1
  152.     set whichFile to getAt(whichList, x)
  153.     if char 1 to the number of chars in whichName of whichFile = whichName then
  154.       put "Attempt to open '" & gPathName & whichFile & "' successful."
  155.       go(1, gPathName & whichFile)
  156.       return 1
  157.       abort()
  158.       exit
  159.     end if
  160.   end repeat
  161.   put "Attempt to open a build version of '" & gPathName & whichName & "' failed."
  162.   return 0
  163. end
  164.  
  165. on makeList listList
  166.   if listp(listList) then
  167.     set countList to count(listList)
  168.     repeat with x = 1 to countList
  169.       set whichList to getAt(listList, x)
  170.       do("global " & whichList)
  171.       do("set " & whichList & "=[ ]")
  172.       do("sort " & whichList)
  173.     end repeat
  174.   else
  175.     if stringp(listList) then
  176.       do("global " & listList)
  177.       do("set " & listList & "=[ ]")
  178.       do("sort " & listList)
  179.     end if
  180.   end if
  181. end
  182.  
  183. on lowercase whichPhrase
  184.   set newPhrase to EMPTY
  185.   set numChars to the number of chars in whichPhrase
  186.   repeat with x = 1 to numChars
  187.     set charX to char x of whichPhrase
  188.     set charToNumX to charToNum(charX)
  189.     if (charToNumX > 64) and (charToNumX < 91) then
  190.       set charX to numToChar(charToNumX + 32)
  191.     end if
  192.     set newPhrase to newPhrase & charX
  193.   end repeat
  194.   return newPhrase
  195. end
  196.  
  197. on uppercase whichPhrase
  198.   set newPhrase to EMPTY
  199.   set numChars to the number of chars in whichPhrase
  200.   repeat with x = 1 to numChars
  201.     set charX to char x of whichPhrase
  202.     set charToNumX to charToNum(charX)
  203.     if (charToNumX > 96) and (charToNumX < 123) then
  204.       set charX to numToChar(charToNumX - 32)
  205.     end if
  206.     set newPhrase to newPhrase & charX
  207.   end repeat
  208.   return newPhrase
  209. end
  210.  
  211. on setInterface whichSprite, whichInterface
  212.   repeat while the mouseDown
  213.     updateStage()
  214.   end repeat
  215.   puppetSprite(9, 0)
  216.   set gWhichInterface to whichInterface
  217.   go(the frame + 1)
  218. end
  219.  
  220. on setProp startSprite, endSprite, whichProp, whichValue
  221.   repeat with x = startSprite to endSprite
  222.     do("set the " & whichProp & " of sprite x=whichValue")
  223.   end repeat
  224. end
  225.  
  226. on delayFor howLong
  227.   set howLong to the timer + howLong
  228.   repeat while the timer < howLong
  229.     updateStage()
  230.   end repeat
  231. end
  232.